-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polling adapter and example #932
Conversation
5080117
to
6c4cb6c
Compare
Hi, @kristjanvalur thanks for the PR. I'll take a look at the logic this week. |
Right. This is extracted from some work I did to make this jive from within UnrealEngine. |
I rebased your PR into a single commit and made a few (mostly formatting) changes/suggestions in a branch on my fork. Mostly it's just to maintain hiredis' coding style. The only actually changed logic:
If you're OK with the changes feel free to apply the patch as whitespace shouldn't make me the author. One question I did have, was whether we may wish to handle the case where |
Great, I'll have a look, and think about the question |
Ok, yes, IMHO we should check for -1 out of select() . Since the socketcompat.h aldready has a helper for poll(), I can change the code to use poll and we get the platform compatible error handling for free. |
poll() also has a much nicer API than select. I'll never touch select() again :) |
I've cherry picked the initial async tests I had added in pr #948 #948 already has this test, and tests for a number of other async issues that I fixed and are rolled up in that PR. |
Going to clean up the tests a little and add basic connection tests... |
edfca73
to
d682533
Compare
So, any news here? IMHO this has been ready for a while now. |
This PR would be highly appreciated. For one thing, writing unit-tests using the polling method is much simpler, since it doesn't require any additional scaffolding or external libraries. If there is anything I need to fix up (style, formatting, collapsing changes, etc) I'm happy to do so. |
If you wouldn't mind rebasing off of master and squashing the polling adapter commits and async test commits where possible, that would be great. Since I have a commit in the middle a full squash is probably not practical. I took a crack at it on my fork, and thankfully it wasn't too painful. |
Its now been cleaned and collapsed into a couple of distinct commits. I'm unsure about whatever formatting concerns you might have, what style rules should be followed. |
Merged, thanks! |
An adaptor to use redisAsyncContext using simple polling. Useful in frameworks where an IO loop isn't present.